<%@ page contentType="text/html; charset=utf-8"%>
<%@ include file="../../../common/include.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>添加奖惩信息</title>
<jsp:include page="../../../common/head.jsp">
	  <jsp:param name="_useCalendar" value="true"/>
</jsp:include>
<script language="javascript">
	var typeArray = new Array();
	function saveData(submitType){
		var objarr = new Array(
			["feeOtherFee.areaId","地区","notEmpty",""],
			["feeOtherFee.otherFeeClasses","奖惩类型","notEmpty",""],
			["feeOtherFee.employeeName","责任人","notEmpty",""],
			["feeOtherFee.otherFeeDate","奖惩日期","notEmpty",""],
			["feeOtherFee.otherFeeAmount","发生金额","notEmpty",""],
			["feeOtherFee.otherFeeAmount","发生金额","float","10.4"],
			["feeOtherFee.otherFeeRemark","备注","max","String:1000"]
		);
		if(xj.CheckAll(objarr))
		{
			if(confirm("确认保存？"))
			{
				$("#submitType").val(submitType);
				document.getElementById("form1").submit();
			}
		}
	}

	//返回
	function goback()
	{
		window.top.close();
	}

		//将select的option的text放入hidden
	function selectOption(objSelect,hiddenId)
	{
		$("#"+hiddenId).val($(objSelect).find("option:selected").text());
	}
	//选择地区读取对应人员数据
	function selectArea()
	{
		$("#areaName").val($("#areaId").find("option:selected").text());
		//读取当前地区的人员数据
		var areaId = $("#areaId").find("option:selected").val();
		var tmp = parseInt(Math.random()*1000000+1);
		var url = 'showFeeTargetFeeDetail.do?feeTarget=地区人员&areaId='+areaId;
		
		$.get(url, {},function (data, textStatus){
			$("#handlerUserId").html(data);
			$("#employeeId").html(data);
			
		});
		
	}
	function filterLevel2()
	{
		var lv1val = $("#otherFeeTypeLvl").val();
		var html="";
		for(var i=0;i<typeArray.length;i++)
		{
			if(typeArray[i][2]==lv1val)
				html+="<option value='"+typeArray[i][0]+"'>"+typeArray[i][1]+"</option>"
		}
		$("#otherFeeClasses").html(html);
	}
	$.ready = function()
	{
		<c:forEach items="${CodeDict}" var="obj">
			<c:if test="${obj.kindId eq '005'}">typeArray.push(["${obj.codeId}","${obj.codeName}","${obj.parentCodeId}"]);</c:if>
		</c:forEach>
		if('${feeOtherFee.otherFeeId}'!='')
			selectArea();
		filterLevel2();
		$("#otherFeeYear").val("${wfn:getDateTime('yyyy')}");
	}
	

	<c:if test="${feeOtherFee.otherFeeId ne null}">
		window.top.returnValue="ok";
	</c:if>
</script>

</head>
<body>
<form name="form1" id="form1"  action="addRewardsPunishment.do" method="post">
	<input type="hidden" id="submitType" name="submitType" value="save"/>
	<div id="body_div">
	<w:ShowTitle name="奖惩登记">
	<w:TitleButton funcName="保存" onClickFunction="saveData('save')" urlImg="${ctx}/images/main/save.png"/>
	<w:TitleButton funcName="保存并复制添加" onClickFunction="saveData('saveAndAdd')" urlImg="${ctx}/images/main/save.png"/>
	<w:TitleButton funcName="返回" onClickFunction="goback()" urlImg="${ctx}/images/main/back.png"/>
	</w:ShowTitle>
	<div id="body_content">
	<table width="100%">
            <tr>
              <td width="80" class="right_align">地区</td>
              <td width="230" class="left_align">
				<input type="hidden" id="areaName" name="feeOtherFee.areaName" value="${feeOtherFee.areaName}"/>
				<w:select name="feeOtherFee.areaId" styleId="areaId" value="${feeOtherFee.areaId}" onchange="selectArea()">
					<w:option optionLabel="请选择" optionValue=""></w:option>
					<w:options options="${CodeDict}" optionLabel="codeName" optionValue="codeId" filterFieldName="parentCodeId" filterFieldValue="001"></w:options>
				</w:select>
			  </td>
              <td width="80" class="right_align"></td>
              <td class="left_align">
				
			  </td>
			</tr>
			<tr>
              <td width="80" class="right_align">奖惩类别</td>
              <td width="170" class="left_align">
				<w:select name="otherFeeTypeLvl" styleId="otherFeeTypeLvl" onchange="filterLevel2()" value="${param.otherFeeTypeLvl}">
					<w:option optionLabel="奖励" optionValue="005001"></w:option>
					<w:option optionLabel="惩罚" optionValue="005002"></w:option>
				</w:select>
					
			  </td>
              <td class="right_align" width="80">奖惩类型</td>
              <td class="left_align">
              
              	<w:select name="feeOtherFee.otherFeeClasses" styleId="otherFeeClasses" value="${feeOtherFee.otherFeeClasses}">
				</w:select>
              </td>
            </tr>
            <tr>
              <td class="right_align">经手人</td>
              <td class="left_align">
	              	<input type="hidden" id="handlerUserName" name="feeOtherFee.handlerUserName" value="${feeOtherFee.handlerUserName}"/>
              	<input type="text" class="selectValueFilter"/>
              	<select name="feeOtherFee.handlerUserId" id="handlerUserId" onchange="selectOption(this,'handlerUserName')"></select>
              </td>
              <td class="right_align">责任人
              </td>
              <td class="left_align">
              	<input type="hidden" id="employeeName" name="feeOtherFee.employeeName" value="${feeOtherFee.employeeName}"/>
              	<input type="text" class="selectValueFilter"/>
              	<select name="feeOtherFee.employeeId" id="employeeId" onchange="selectOption(this,'employeeName')"></select>
              </td>
            </tr>
            <tr>
             <td class="right_align">奖惩年度</td>
              <td class="left_align">
            	<select name="feeOtherFee.otherFeeYear" id="otherFeeYear">
		      				<c:forEach begin="2013" end="${wfn:getDateTime('yyyy')}" var="year">
		      					<option value="${year}">${year}</option>
		      				</c:forEach>
		      			</select>
		     </td>
              <td class="right_align">奖惩月份</td>
              <td class="left_align">
						<w:select name="feeOtherFee.otherFeeMonth" styleId="otherFeeMonth" styleClass="selectLengthAuto" value="${wfn:getDateTime('MM')}" >
							<w:option optionLabel="01" optionValue="01"></w:option>
							<w:option optionLabel="02" optionValue="02"></w:option>
							<w:option optionLabel="03" optionValue="03"></w:option>
							<w:option optionLabel="04" optionValue="04"></w:option>
							<w:option optionLabel="05" optionValue="05"></w:option>
							<w:option optionLabel="06" optionValue="06"></w:option>
							<w:option optionLabel="07" optionValue="07"></w:option>
							<w:option optionLabel="08" optionValue="08"></w:option>
							<w:option optionLabel="09" optionValue="09"></w:option>
							<w:option optionLabel="10" optionValue="10"></w:option>
							<w:option optionLabel="11" optionValue="11"></w:option>
							<w:option optionLabel="12" optionValue="12"></w:option>
						</w:select>
			</td>
            </tr>
            <tr>
              <td class="right_align">奖惩日期</td>
              <td class="left_align">
				<input type="text" name="feeOtherFee.otherFeeDate" value="<fmt:formatDate value='${feeOtherFee.otherFeeDate}' pattern='yyyy-MM-dd' />" onfocus="new WdatePicker()" readonly="readonly" class="inputCal"/>
              </td>
              <td class="right_align">登记日期</td>
              <td class="left_align">
				<input type="text" name="feeOtherFee.createDate" value="${wfn:getDateTime("yyyy-MM-dd")}" onfocus="new WdatePicker()" readonly="readonly" class="inputCal"/>
              </td>
            </tr>
            <tr>
              <td class="right_align">金额</td>
              <td class="left_align">
              	<input type="text" name="feeOtherFee.otherFeeAmount"/>
              </td>
              <td class="right_align">&nbsp;</td>
              <td class="left_align">&nbsp;</td>
            </tr>
            <tr>
              <td class="right_align">备注</td>
              <td colspan="3" class="left_align">
              	<textarea rows="5" cols="80" name="feeOtherFee.otherFeeRemark">${feeOtherFee.otherFeeRemark}</textarea>
              </td>
            </tr>
           	<c:if test="${feeOtherFee.otherFeeId ne null}">
            <tr>
              <td colspan="4" class="left_align warnText">
              	数据保存成功，您可以利用以上数据继续填报！
              </td>
            </tr>
           	</c:if>
          </table>
	</div>
	</div>	
</form>
</body>
</html> 